package com.javasm.transfer.goods;

import com.javasm.domin.entity.goods.*;
import com.javasm.domin.vo.goods.GoodsAdjustVo;
import com.javasm.domin.vo.goods.GoodsVO;
import com.javasm.transfer.base.BaseTransfer;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author：Drd
 * @Version：1.0
 * @Date：2022/1/17-16:14
 * @Since:jdk1.8
 * @Description:
 */
@Component
@RequiredArgsConstructor
public class GoodsAdjustTransfer extends BaseTransfer<GoodsAdjust, GoodsAdjustVo> {

    public List<GoodsAdjustVo> setInfo(List<GoodsAdjust> list) {
        List<GoodsAdjustVo> goodsAdjustVos = super.toVO(list);
        for (int i = 0; i < goodsAdjustVos.size(); i++) {
            GoodsAdjust goodsAdjust = list.get(i);

            GoodsAdjustVo goodsAdjustVo = goodsAdjustVos.get(i);
            if (goodsAdjust.getApproveStatus()  == null) {
                goodsAdjustVo.setApproveStatus("未知");
            } else if (goodsAdjust.getApproveStatus() == 0) {
                goodsAdjustVo.setApproveStatus("待审核");
            } else if (goodsAdjust.getApproveStatus() == 1) {
                goodsAdjustVo.setApproveStatus("已审核");
            } else if (goodsAdjust.getApproveStatus() == 2) {
                goodsAdjustVo.setApproveStatus("审核不通过");
            } else {
                goodsAdjustVo.setApproveStatus("未知");
            }
        }
        return goodsAdjustVos;
    }
}
